Summary: HTMLEditor
normalizes collapsible
white-spaces which user typed to make all of them visible, i.e.,
as not collapsed.
Currently, our builtin editor keeps traditional behavior since
it's initially implemented. That is, allow to puts an ASCII
white-space at last of the white-space sequence and convert its
previous one as an NBSP. If it's the last white-space immediately
before a block boundary, HTMLEditor
puts a <br>
element to make it visible (this
rendering result is also incompatible with the other browsers).
On the other hand, the other browsers puts an NBSP to the last white-space of a white-space sequence and always normalizes the white-space sequence with pairs of an NBSP and an ASCII white-space (the order is opposite between Chrome and Safari, though). This behavior is more stable and simpler than ours because web apps may delete following things of typed white-space without maintaining that it stays visible (This actually happens in Gmail).
Therefore, we should follow their behavior, and I think it's reasonable to make us behave as Chrome and actually I implemented the new normalizer which is almost compatible with Chrome. (Unfortunately, in some edge cases, we get different result whether normalize or does not do that for surrounding white-spaces at editing range.)
In the following bug, I'll enable the new behavior for the nightly builds and early beta builds. Then, I'll enable them in all builds after watching regressions reports in a couple of releases.
(The legacy paths will be deleted once it's shipped in all channels soon.)
Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1951832
Specification: N/A
Platform coverage: All
Preference: editor.white_space_normalization.blink_compatible
web-platform-tests: https://wpt.fyi/results/editing/whitespaces/chrome-compat?label=master&label=experimental&aligned
NOTE: For web developers, I strongly recommend you to use `white-space:
pre-wrap
` or something to prevent the white-space
normalization since users cannot get same result as they typed if
they typed NBSPs because NBSPs are treated as ASCII white-spaces
if white-spaces are collapsible (e.g., when `white-space:
normal
`, `white-space: pre-line
` and `white-space:
nowrap
`).
-- Masayuki Nakano <masa...@d-toybox.com> Working on DOM, Events, editor and IME handling for Gecko
We'll ship this new behavior in all channels starting with 139.
According to the reported bugs, this will fix a lot of web-compat issues on Office 365.
Note that once this is shipped in the release channel, I'll delete the legacy normalizer soon because it wastes the binary size and makes the code harder to read.
--
You received this message because you are subscribed to the Google Groups "dev-pl...@mozilla.org" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dev-platform...@mozilla.org.
To view this discussion visit https://groups.google.com/a/mozilla.org/d/msgid/dev-platform/1a99cde7-2ada-4dc2-ae66-5a4568a20929%40d-toybox.com.